//
//  MineChangeZhiFuMiMaVC.m
//  shopping
//
//  Created by 马田成 on 2017/9/30.
//  Copyright © 2017年 qianyi. All rights reserved.
//

#import "MineChangeZhiFuMiMaVC.h"

@interface MineChangeZhiFuMiMaVC ()
@property (weak, nonatomic) IBOutlet UITextField *oldPasswordTF;
@property (weak, nonatomic) IBOutlet UITextField *xinPasswordTF;
@property (weak, nonatomic) IBOutlet UITextField *xinAgainPasswTF;


@end

@implementation MineChangeZhiFuMiMaVC
- (void)viewWillAppear:(BOOL)animated{
    
    
    [super viewWillAppear:animated];
    [self.navigationController setNavigationBarHidden:NO animated:NO];
    
}
- (void)viewDidLoad {
    [super viewDidLoad];
    [self setTitle:@"修改支付密码"];
    // Do any additional setup after loading the view from its nib.
}
- (IBAction)sureButtonCick:(UIButton *)sender {
    
    NSMutableDictionary *productParams=[[NSMutableDictionary alloc]init];
    NSString *token = [PublicFunction getConfigWithKey:@"token"];
    // NSString *token = @"32728a411b83e29b9836262a72477e3e0dac";
    
    if ([self.xinPasswordTF.text isEqualToString:self.xinAgainPasswTF.text]) {
        [productParams setValue:token forKey:@"token"];
        [productParams setValue:self.oldPasswordTF.text forKey:@"old_pwd"];
        [productParams setValue:self.xinPasswordTF.text forKey:@"new_pwd"];
        [[MNetworkHandler sharedInstance]conURL:adminMingEditPayPwd networkType:NetWorkPOST params:productParams delegate:nil showHUD:NO successBlock:^(id returnData) {
            
            
            if ([[returnData objectForKey:@"result_code"]intValue]==100) {
                
                
                [PublicFunction showAlert:nil message:@"修改成功" duration:5.0f];
                
                [self.navigationController popViewControllerAnimated:YES];
                
                
            }
            
            else {
                
                [PublicFunction showAlert:nil message:[returnData objectForKey:@"message"] duration:5.0f];
                
            }
            
        } failureBlock:^(NSError *error) {
            
            NSLog(@"%@",error);
            
//            [PublicFunction showAlert:nil message:@"没有连接网络" duration:10.0f];
            
        }];
        
        
    }else {
        
        [PublicFunction showAlert:nil message:@"请输入正确密码" duration:10.0f];
        
    }
    

    
    
    
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
